package com.oocl.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oocl.dao.ClientsDao;
import com.oocl.dao.base.BaseDao;
import com.oocl.entity.Clients;
import com.oocl.service.ClientsService;

@Service(value="clientsService")
public class ClientsServiceImpl implements ClientsService {

	@Resource(name="clientsDao")
	private ClientsDao clientsDao;
	@Resource(name="baseDao")
	private BaseDao baseDao;
	@Override
	@Transactional
	public Clients findClientsByCid(String cid) {
		// TODO Auto-generated method stub		
		Clients client=new Clients();
		client=(Clients) baseDao.find(Clients.class, cid);
		return client;
	}
	@Override
	public Clients loadClient(Clients client) {
		Clients clients = clientsDao.loadClient(client);
		return clients;
	}
	@Override
	@Transactional
	public Clients addClient(Clients client){
		Clients clients=(Clients) baseDao.persist(client);
		return clients;
	}
	@Override
	public Clients findClientsByCname(String cname) {
		// TODO Auto-generated method stub
		Clients clients=(Clients) baseDao.find(Clients.class, cname);
		return clients;
	}

}
